home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
...taking it to the Macs!
/
...taking it to the Macs!.iso
/
Extras
/
ActiveX Mac SDK
/
ActiveX SDK
/
Container Common
/
CContainerManager.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-01-03
|
2KB
|
120 lines
#include "headers.h"
#include <LArray.h>
#include "CContainerManager.h"
//
// CContainerManager::CContainerManager
//
// Default constructor
//
CContainerManager::CContainerManager(void)
{
// Allocate an array to hold the container items
mContainers = new LArray( sizeof(void*));
}
//
// CContainerManager::~CContainerManager
//
// Destructor
//
CContainerManager::~CContainerManager(void)
{
delete mContainers;
}
//
// CContainerManager::IContainerManager::AddContainer
//
void
CContainerManager::AddContainer(CContainer* inContainer)
{
mContainers->InsertItemsAt(1, 32000, &inContainer);
}
//
// CContainerManager::IContainerManager::RemoveContainer
//
void
CContainerManager::RemoveContainer(CContainer* inContainer)
{
mContainers->Remove(&inContainer);
}
//
// CContainerManager::ICollection::GetCount
//
unsigned long
CContainerManager::GetCount(void)
{
return mContainers->GetCount();
}
//
// CContainerManager::FetchContainer
//
void
CContainerManager::FetchContainer(short Index, CContainer** outContainer)
{
mContainers->FetchItemAt(Index, outContainer);
}
//
// CContainerManager::IContainerManager::FindContainer
//
CContainer*
CContainerManager::FindContainer(CXSite* inSite, PlatformPort* inHostPort)
{
CContainer *Container, *OutContainer = nil;
short i, ContainerCount;
// Release each connection point
for ( i = 1, ContainerCount = mContainers->GetCount(); i <= ContainerCount && !OutContainer; i++)
{
mContainers->FetchItemAt(i, &Container);
// if finding by site
if ( inSite )
{
CXSite* Site;
short SiteCount;
short j;
for ( j = 1, SiteCount = Container->GetCount(); j <= SiteCount; j++ )
{
Container->FetchSite(j, &Site);
// if this is a match, set the outContainer and bail
if ( Site == inSite )
OutContainer = Container;
}
}
else if ( inHostPort ) // finding by port
{
if ( Container->GetPort() == inHostPort )
OutContainer = Container;
}
}
return OutContainer;
}